﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Mobile.ContainerModel;
using Microsoft.Practices.ObjectBuilder2;

namespace Microsoft.Practices.Unity
{
	public class ContainerControlledLifetimeManager : LifetimeManager
	{
        public ContainerControlledLifetimeManager()
        {
            ReuseScope = ReuseScope.Hierarchy;
        }

		public object value;

		public override object GetValue()
		{
			return value;
		}

		public override void RemoveValue()
		{
			value = null;
		}

		public override void SetValue(object newValue)
		{
			value = newValue;
		}
	}
}

namespace Microsoft.Practices.Unity
{
	public abstract class LifetimeManager : ILifetimePolicy, IBuilderPolicy
	{
        public ReuseScope ReuseScope { get; set; }
		protected LifetimeManager()
		{
		    ReuseScope = ReuseScope.None;
		}
		public abstract object GetValue();
		public abstract void RemoveValue();
		public abstract void SetValue(object newValue);
	}
}


namespace Microsoft.Practices.ObjectBuilder2
{
	public interface ILifetimePolicy : IBuilderPolicy
	{
		object GetValue();
		void RemoveValue();
		void SetValue(object newValue);
	}
}